﻿using ASmile.Com;
using ASmile.Com.Da;
using ASmile.Com.RoleUser;
using ASmile.DBModel;
using Microsoft.AspNetCore.Mvc;

namespace ASmile.Web.ApiControllers.SysManage
{
    [Route("api/SysManage/[controller]/[action]")]
    [ApiExplorerSettings(GroupName = "SysManage")]
    public class RoleUserController : BaseApiController<RoleUserBLL>
    {
        //[HttpPost]
        //public ApiResultList<Sys_Role> GetRoleData(System.Text.Json.JsonElement obj)
        //{
        //    string serVal = obj.GetString(nameof(serVal));
        //    return BLLObj.GetRoleData(serVal);
        //}
        /// <summary>
        /// 获取指定角色的所有员工
        /// RoleId、SearchVal 不能为空
        /// </summary>
        [HttpPost]
        public ApiResultList<VSys_RoleUser> GetRoleUsers(ArgRoleUserSearch arg)
        {
            return BLLObj.GetRoleUsers(arg);
        }
        /// <summary>
        /// 获取指定角色下的所有用户Id列表
        /// RoleId 不能为空
        /// </summary>
        [HttpPost]
        public ApiResultList<string> GetRoleUserIds(ArgRoleUserSearch arg)
        {
            return BLLObj.GetRoleUserIds(arg);
        }
        /// <summary>
        /// 指定角色增加用户(多个)
        /// </summary>
        [HttpPost]
        public ApiResult AddUsers(ArgRoleUserAdd arg)
        {
            return BLLObj.AddUsers(arg);
        }
        [HttpPost]
        public ApiResult Remove(ArgId arg)
        {
            return BLLObj.Remove(arg);
        }
    }
}